<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
    <head>
        <%@include file="/WEB-INF/jspf/head.jspf" %>

         <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/portal_1/css/login.css"/> 
    </head>
    <body>
        <div id="html">
            <%@include file="/WEB-INF/jspf/header.jspf" %>
            <div id="login">
                <div class="left">
                    <form action="login" method="post" id="myform">
 			
 			<p>
 			<label>用户名：</label><input type="text"  name="loginName" onblur="checkloginid(this);" id="loginName"/><font color="red"><span id="loginidspan"></span></font>
 			</p>
 			<p>
 			<label>密码：</label><input id="initpwd" type="password" name="passWord" onblur="checkpwd(this);" /><font color="red"><span id="pwdspan"></span></font>
 			</p>
 			
 			
 			<p>
 			<label>验证码：</label><input id="yzm" type="text" name="yzm"  /><img style='cursor:pointer' src='/fbd/validatecode.jpg' onclick="changeyz();" id="yz"/><font color="red"><span id="yzspan"></span></font>
 			</p>
 			
 			<p>
 				<input type="button" class="button" value="登录" onclick="validate();"/>
 			</p>
 		</form>
                </div>
                <div class="right">
                    <h2>用户须知</h2>
                    <p>由于本网站涉及房屋买卖，所以注册用户必须以真实身份注册。</p>
                </div>
                <br class="clear"/>
            </div>
            <%@include file="/WEB-INF/jspf/footer.jspf" %>
        </div>
        <script type="text/javascript">
 var loginidspan=document.getElementById("loginidspan");
 var pwdspan=document.getElementById("pwdspan");
 var yz=document.getElementById("yzspan");
 
 	function checkloginid(obj){ 	
 	if(obj.value.length<=0){	
 	loginidspan.innerHTML="请输入用户名";
 	}else{	
 	 $.ajax({
     		type:"post",
            url:"member/checkName.do",
            dataType:"text",
            data:"loginID="+obj.value,    
	     success: function(msg){       
	      		if(msg==2){
	      		loginidspan.innerHTML="";
	      		}else if(msg==1){
	      		loginidspan.innerHTML="该用户不存在";
	      		}
	       }   
		});  	
 	
 	
 	} 	
 	}
 function changeyz(){
 	var im=document.getElementById("yz");
 	im.src='/fbd/validatecode.jpg?id=' + Math.random();
 }
 
 
 	function checkpwd(obj){ 	
 	if(obj.value.length<=0){	
 	pwdspan.innerHTML="请输入密码";
 	}else{ 	
 	pwdspan.innerHTML="";
 	} 	
 	}
 	
 	function checkyz(obj){
 	var b=true;
 	
 	if(obj.value.length<=0){	
 	yzspan.innerHTML="请输入验证码";
 	}else{
 	 $.ajax({
     		type:"post",
            url:"member/checkYZM.do",
            dataType:"text",
            data:"yzm="+obj.value, 
    
	     	success: function(msg){       
	      		if(msg==2){
	      		yzspan.innerHTML="验证码错误";
	      		}else if(msg==1){
	      		yzspan.innerHTML="";
	      		}
	       }   
		});  	
 //	yzspan.innerHTML="";
 	} 	
 	}
 	
 	function validate(){
 	var f=document.getElementById("myform");
 	
 	if(document.getElementById("yzm").value.length<=0){	
 	yzspan.innerHTML="请输入验证码";
 	
 	}else{
 	if(yzspan.innerHTML=="验证码错误"){
 	return;
 	}else{
 	if(document.getElementById("loginName").value.length<=0){
 	loginidspan.innerHTML="请输入用户名";
 	}else if(loginidspan.innerHTML=="该用户不存在"){
 	return;
 	}else if(document.getElementById("initpwd").value.length<=0){
 		pwdspan.innerHTML="请输入密码";
 	}else{
 	f.submit();
 	}
 	}
 	}
 	}
 </script>

        
    </body>
</html>
